<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>从两个数组里生成最小数字</title>
</head>
<body>
  <script>
    function fn(nums1, nums2) {
      nums1.sort((a, b) => a - b);
      nums2.sort((a, b) => a - b);
      for (let i = 0; i < nums1.length; i++) {
        for (let j = 0; j < nums2.length; j++) {
          if (nums1[i] == nums2[j]) {
            return nums2[j]
          }
        }
      }
      return nums1[0] > nums2[0] ? nums2[0] * 10 + nums1[0] : nums1[0] * 10 + nums2[0];
    }
    console.log(fn([4, 1, 3], [5, 7]))
  </script>
</body>
</html>